#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define N 10
void find_two_largest(const int *a, int n, int *largest, int *second_largest);
int main(void)
{
    srand((unsigned) time(NULL));
    int a[N];
    for (int i = 0; i < N; i++)
        a[i] = rand() % 100;
    for (int i = 0; i < N; i++)
        printf("%s%d%s", i ? ", " : "", a[i], N - 1 - i ? "" : "\n");
    int l1, l2;
    find_two_largest(a, N, &l1, &l2);
    printf("%d %d\n", l1, l2);
    return 0;
}
void find_two_largest(const int *a, int n, int *largest, int *second_largest) {
    if (*a > *(a + 1)) {
        *largest = *a;
        *second_largest = *(a + 1);
    } else {
        *second_largest = *a;
        *largest = *(a + 1);
    }
    for (const int *i = a + 2; i < a + n; i++) {
        if (*i > *largest) {
            *second_largest = *largest;
            *largest = *i;
        } else if (*i > *second_largest)
            *second_largest = *i;
    }
}